home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 August / ChipCD 8.02.iso / drivers / pack / files / o56k_usb_V1.0_Mac__Standard.sit / 56kusb / ZyXEL Modem Scripts / ZyXEL 56K Modem next >
Text File  |  2000-07-04  |  14KB  |  751 lines

  1. !  ZyXEL 56K Modem
  2. !
  3. !    Copyright:    ⌐ 1991-1998 Apple Computer, Inc.    All Rights Reserved.
  4. !
  5. !  'mlts' resource info for this modem:
  6. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  7. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  8. !    byte 3 == 40 -> max number of chars in varstr 7
  9. !    byte 4 == 40 -> max number of chars in varstr 8
  10. !    byte 5 == 40 -> max number of chars in varstr 9
  11. !    
  12. @ORIGINATE
  13. @ANSWER
  14. ! ---- Initial modem setup ----
  15. ! In originate mode, set serial port speed depending upon the compression flag
  16. ! - A higher rate with compression on (PPP) to handle expanded data from the modem
  17. ! - A lower rate closer to the DCE when compression is off (ARA)
  18. ifstr 5 1 "0"
  19. serreset 115200, 0, 8, 1
  20. jump 2
  21. !
  22. @LABEL 1
  23. serreset 57600, 0, 8, 1
  24. !
  25. @LABEL 2
  26. hsreset 0 0 0 0 0 0
  27. settries 0
  28. !
  29. ! Get the modem's attention
  30. !
  31. matchclr
  32. matchstr 1 3 "OK\13\10"
  33. write "AT\13"
  34. matchread 60
  35. pause 90
  36. !
  37. @LABEL 3
  38. matchclr
  39. matchstr 1 4   "OK\13\10"
  40. matchstr 2 101 "ERROR\13\10"
  41. write "AT&FE0&D2&C1X7&K4\13"
  42. matchread 90
  43. inctries
  44. iftries 3 101
  45. !
  46. ! Reset the Modem on setup failure
  47. !
  48. DTRClear
  49. pause 5
  50. DTRSet
  51. flush
  52. pause 90
  53. jump 3
  54. !
  55. !
  56. @LABEL 4
  57. ! Modem now responding and configured for full EC/DC functions.
  58. ! Varstring 4 , reliable link protocol:
  59. !    = 0, handled by computer (ARAP)
  60. !    = 1, handled by modem (PPP)
  61. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  62. ! If PPP or Cellular mode, jump to 5, otherwise (ARA) disable EC/DC.
  63. ifstr 4 5 "1"
  64. ifstr 4 5 "2"
  65. !
  66. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  67. matchclr
  68. matchstr 1 9 "OK\13\10"
  69. write "AT&K0\13"
  70. matchread 30
  71. jump 101
  72. !
  73. !
  74. @LABEL 5
  75. ! This is where MNP10 (or MNP10EC) could go, if/when we support that.
  76. ! Standard EC/DC is still on.  Decide whether to turn off DC.
  77. ! Varstring 5, compression protocol:
  78. !    = 0, handled by computer 
  79. !    = 1, handled by modem
  80. ifstr 5 9 "1"
  81. !
  82. ! Varstring 5 == 0, turn off compression protocol in modem.
  83. matchclr
  84. matchstr 1 9 "OK\13\10"
  85. write "AT&K0\13"
  86. matchread 30
  87. jump 101
  88. !
  89. !
  90. @LABEL 9
  91. ! If speaker on flag is true, jump to 13.  Otherwise, turn the speaker off.
  92. ! Varstring 2, modem speaker:
  93. !    = 0, speaker off
  94. !    = 1, speaker on
  95. ifstr 2 13 "1"
  96. pause 5
  97. matchclr
  98. matchstr 1 13 "OK\13\10"
  99. write "ATM0\13"
  100. matchread 30
  101. jump 101
  102. !
  103. ! Modem ready, wait for a call or originate a call
  104. !
  105. @LABEL 13
  106. ifANSWER 32
  107. !
  108. !
  109. ! ---- Originating a call ----
  110. ! For normal dialing, jump to 19.  Otherwise, manual dial jumps to 15, blind dial
  111. !    jumps to 17.
  112. ! Varstring 6, dialing mode:
  113. !    = 0, normal dialing
  114. !    = 1, blind dialing
  115. !    = 2, manual dialing
  116. ifstr 6 17 "1"
  117. ifstr 6 15 "2"
  118. jump 19
  119. !
  120. @LABEL 15
  121. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  122. ASK 2 "Pick up the phone & dial ^1.  Hit OK when the phone rings, then hangup." 107
  123. note "Manual dialing initiated" 3
  124. ! X1S6=4 to ignore dialtone 4 seconds, & ignore busy, D to dial, \^ generates data tone
  125. !write "ATX1D\^\13"                            (ÑÑÑÑÑ Original Wallstreet script)
  126. write "ATX1S6=4D\13"
  127. jump 32
  128. !
  129. @LABEL 17
  130. note "Dialing without tone" 3
  131. matchclr
  132. matchstr 1 19 "OK\13\10"
  133. ! X1S6=4 to ignore dialtone 4 seconds, & ignore busy for blind dialing.
  134. !write "ATX1\13"                            (ÑÑÑÑÑ Original Wallstreet script)
  135. write "ATS41.4=1\13"
  136. matchread 30
  137. jump 101
  138. !
  139. !
  140. @LABEL 19
  141. ! This is where we break up long dialstrings
  142. ! Display the full dialstring contained in Varstring 1
  143. note "Dialing ^1" 3
  144. !
  145. ! Varstrings 7, 8 and 9, contain dialstring fragments
  146. !    Long phone numbers may have been split into smaller groups
  147. !    so that the modem can use them
  148. ! Check to see whether these fragments exist.  If they do, dial them one at a time.
  149. ! If not, jump ahead and dial the remaining phone number.  Use the data tone.
  150. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  151. ! Varstring 8 == blank (dialstring in varstring 7)
  152. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  153. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  154. ! \^ is added to the dialstring to force the modem to generate a data tone
  155. ifstr 8 27 " "
  156. ifstr 9 24 " "
  157. !
  158. !  Write dialstring in varstrings 7, 8 & 9
  159. matchclr
  160. matchstr 1 21 "OK\13\10"
  161. write "ATD^3^7;\13"
  162. matchread 400
  163. jump 101
  164. @LABEL 21
  165. matchclr
  166. matchstr 1 22 "OK\13\10"
  167. write "ATD^3^8;\13"
  168. matchread 400
  169. jump 101
  170. @LABEL 22
  171. write "ATD^3^9\13"
  172. jump 32
  173. !
  174. !
  175. @LABEL 24
  176. !  Write dialstring in varstrings 7 & 8
  177. matchclr
  178. matchstr 1 25 "OK\13\10"
  179. write "ATD^3^7;\13"
  180. matchread 400
  181. jump 101
  182. @LABEL 25
  183. write "ATD^3^8\13"
  184. jump 32
  185. !
  186. @LABEL 27
  187. !  Write dialstring in varstring 7
  188. write "ATD^3^7\13"
  189. !
  190. !
  191. !    ---- Connection response ----
  192. !
  193. ! The following section will parse modem responses of five types:
  194. !   1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
  195. !   2) CONNECT xxx/ARQ/V42
  196. !   3) Standard incoming and outgoing call progress messages
  197. !   4) FAX/DATA discrimination messages
  198. !   5) International DELAYED & BLACKLISTED restrictions.
  199. !
  200. @LABEL 32
  201. matchclr
  202. matchstr  1 88  "RING\13\10"
  203. matchstr  2 102 "NO DIALTONE\13\10"
  204. matchstr  3 103 "NO CARRIER"
  205. matchstr  4 103 "ERROR\13\10"
  206. matchstr  5 104 "BUSY\13\10"
  207. matchstr  6 105 "NO ANSWER\13\10"
  208. matchstr  7 33  "CONNECT "
  209. matchstr  8 32  "CARRIER"
  210. matchstr  9 40  "CONNECT\13\10"
  211. matchstr 10 82  "PROTOCOL: LAP"
  212. matchstr 11 82  "PROTOCOL: MNP"
  213. matchstr 12 82  "PROTOCOL: ALT"
  214. matchstr 13 84  "COMPRESSION: V"
  215. matchstr 14 84  "COMPRESSION: MNP5"
  216. matchstr 15 84  "COMPRESSION: CLASS"
  217. matchstr 16 110  "DELAYED  "
  218. matchstr 17 111  "BLACKLISTED\13\10"
  219. matchread 700
  220. ifANSWER 32
  221. jump 101
  222. !
  223. @LABEL 33
  224. matchclr
  225.  
  226. matchstr  1 39 "2400\13"
  227. matchstr  2 39 "2400/"
  228. matchstr  3 40 "4800\13"
  229. matchstr  4 40 "4800/"
  230. matchstr  5 41 "7200"
  231. matchstr  6 42 "9600"
  232. matchstr  7 43 "12000"
  233. matchstr  8 44 "14400"
  234. matchstr  9 45 "16800"
  235. matchstr 10 46 "19200"
  236. matchstr 11 47 "21600"
  237. matchstr 12 48 "24000"
  238. matchstr 13 49 "26400"
  239. matchstr 14 50 "28800"
  240. matchstr 15 51 "29333"
  241. matchstr 16 52 "30667"
  242. matchstr 17 53 "31200"
  243. matchstr 18 54 "32000"
  244. matchstr 19 55 "33333"
  245. matchstr 20 56 "33600"
  246. matchstr 21 57 "34000"
  247. matchstr 22 58 "34667"
  248. matchstr 23 59 "36000"
  249. matchstr 24 60 "37333"
  250. matchstr 25 61 "38000"
  251. matchstr 26 62 "38667"
  252. matchstr 27 63 "40000"
  253. matchstr 28 64 "41333"
  254. matchstr 29 65 "42000"
  255. matchstr 30 66 "42667"
  256. matchstr 31 67 "44000"
  257. matchstr 32 68 "45333"
  258. matchstr 33 69 "46000"
  259. matchstr 34 70 "46667"
  260. matchstr 35 71 "48000"
  261. matchstr 36 72 "49333"
  262. matchstr 37 73 "50000"
  263. matchstr 38 74 "50667"
  264. matchstr 39 75 "52000"
  265. matchstr 40 76 "53333"
  266. matchstr 41 77 "54000"
  267. matchstr 42 78 "54667"
  268. matchstr 43 79 "56000"
  269. matchread 30
  270. jump 71
  271. !
  272. ! -- Connection rates --
  273. ! CommunicatingAt informs ARA of the raw modem to modem
  274. ! connection speed.
  275. !
  276. @LABEL 39
  277. note "Communicating at 2400 bps." 2
  278. CommunicatingAt 2400
  279. jump 81
  280. !
  281. @LABEL 40
  282. note "Communicating at 4800 bps." 2
  283. CommunicatingAt 4800
  284. jump 81
  285. !
  286. @LABEL 41
  287. note "Communicating at 7200 bps." 2
  288. CommunicatingAt 7200
  289. jump 81
  290. !
  291. @LABEL 42
  292. note "Communicating at 9600 bps." 2
  293. CommunicatingAt 9600
  294. jump 81
  295. !
  296. @LABEL 43
  297. note "Communicating at 12400 bps." 2
  298. CommunicatingAt 12400
  299. jump 81
  300. !
  301. @LABEL 44
  302. note "Communicating at 14400 bps." 2
  303. CommunicatingAt 14400
  304. jump 81
  305. !
  306. @LABEL 45
  307. note "Communicating at 16800 bps." 2
  308. CommunicatingAt 16800
  309. jump 81
  310. !
  311. @LABEL 46
  312. note "Communicating at 19200 bps." 2
  313. CommunicatingAt 19200
  314. jump 81
  315. !
  316. @LABEL 47
  317. note "Communicating at 21600 bps." 2
  318. CommunicatingAt 21600
  319. jump 81
  320. !
  321. @LABEL 48
  322. note "Communicating at 24000 bps." 2
  323. CommunicatingAt 24000
  324. jump 81
  325. !
  326. @LABEL 49
  327. note "Communicating at 26400 bps." 2
  328. CommunicatingAt 26400
  329. jump 81
  330. !
  331. @LABEL 50
  332. note "Communicating at 28800 bps." 2
  333. CommunicatingAt 28800
  334. jump 81
  335. !
  336. @LABEL 51
  337. note "Communicating at 29333 bps." 2
  338. CommunicatingAt 29333
  339. jump 81
  340. !
  341. @LABEL 52
  342. note "Communicating at 30667 bps." 2
  343. CommunicatingAt 30667
  344. jump 81
  345. !
  346. @LABEL 53
  347. note "Communicating at 31200 bps." 2
  348. CommunicatingAt 31200
  349. jump 81
  350. !
  351. @LABEL 54
  352. note "Communicating at 32000 bps." 2
  353. CommunicatingAt 32000
  354. jump 81
  355. !
  356. @LABEL 55
  357. note "Communicating at 33333 bps." 2
  358. CommunicatingAt 33333
  359. jump 81
  360. !
  361. @LABEL 56
  362. note "Communicating at 33600 bps." 2
  363. CommunicatingAt 33600
  364. jump 81
  365. !
  366. @LABEL 57
  367. note "Communicating at 34000 bps." 2
  368. CommunicatingAt 34000
  369. jump 81
  370. !
  371. @LABEL 58
  372. note "Communicating at 34667 bps." 2
  373. CommunicatingAt 34667
  374. jump 81
  375. !
  376. @LABEL 59
  377. note "Communicating at 36000 bps." 2
  378. CommunicatingAt 36000
  379. jump 81
  380. !
  381. @LABEL 60
  382. note "Communicating at 37333 bps." 2
  383. CommunicatingAt 37333
  384. jump 81
  385. !
  386. @LABEL 61
  387. note "Communicating at 38000 bps." 2
  388. CommunicatingAt 38000
  389. jump 81
  390. !
  391. @LABEL 62
  392. note "Communicating at 38667 bps." 2
  393. CommunicatingAt 38667
  394. jump 81
  395. !
  396. @LABEL 63
  397. note "Communicating at 40000 bps." 2
  398. CommunicatingAt 40000
  399. jump 81
  400. !
  401. @LABEL 64
  402. note "Communicating at 41333 bps." 2
  403. CommunicatingAt 41333
  404. jump 81
  405. !
  406. @LABEL 65
  407. note "Communicating at 42000 bps." 2
  408. CommunicatingAt 42000
  409. jump 81
  410. !
  411. @LABEL 66
  412. note "Communicating at 42667 bps." 2
  413. CommunicatingAt 42667
  414. jump 81
  415. !
  416. @LABEL 67
  417. note "Communicating at 44000 bps." 2
  418. CommunicatingAt 44000
  419. jump 81
  420. !
  421. @LABEL 68
  422. note "Communicating at 45333 bps." 2
  423. CommunicatingAt 45333
  424. jump 81
  425. !
  426. @LABEL 69
  427. note "Communicating at 46000 bps." 2
  428. CommunicatingAt 46000
  429. jump 81
  430. !
  431. @LABEL 70
  432. note "Communicating at 46667 bps." 2
  433. CommunicatingAt 46667
  434. jump 81
  435. !
  436. @LABEL 71
  437. note "Communicating at 48000 bps." 2
  438. CommunicatingAt 48000
  439. jump 81
  440. !
  441. @LABEL 72
  442. note "Communicating at 49333 bps." 2
  443. CommunicatingAt 49333
  444. jump 81
  445. !
  446. @LABEL 73
  447. note "Communicating at 50000 bps." 2
  448. CommunicatingAt 50000
  449. jump 81
  450. !
  451. @LABEL 74
  452. note "Communicating at 50667 bps." 2
  453. CommunicatingAt 50667
  454. jump 81
  455. !
  456. @LABEL 75
  457. note "Communicating at 52000 bps." 2
  458. CommunicatingAt 52000
  459. jump 81
  460. !
  461. @LABEL 76
  462. note "Communicating at 53333 bps." 2
  463. CommunicatingAt 53333
  464. jump 81
  465. !
  466. @LABEL 77
  467. note "Communicating at 54000 bps." 2
  468. CommunicatingAt 54000
  469. jump 81
  470. !
  471. @LABEL 78
  472. note "Communicating at 54667 bps." 2
  473. CommunicatingAt 54667
  474. jump 81
  475. !
  476. @LABEL 79
  477. note "Communicating at 56000 bps." 2
  478. CommunicatingAt 56000
  479. jump 81
  480. !
  481. @LABEL 80
  482. note "Communicating at an unknown rate." 2
  483. jump 81
  484. !
  485. ! Look for reliablilty and compression results 
  486. ! at the end of the connect result.
  487. !
  488. @LABEL 81
  489. matchclr
  490. matchstr  1 83 "LAPM"
  491. matchstr  2 83 "REL"
  492. matchstr  3 83 "ARQ"
  493. matchstr  4 85 "COMP/"
  494. matchstr  5 85 "COMP\13"
  495. matchstr  6 83 "V42/"
  496. matchstr  7 83 "V42\13"
  497. matchstr  8 85 "V42BIS"
  498. matchstr  9 85 "V42bis"
  499. matchstr 10 83 "MNP\13"
  500. matchstr 11 85 "MNP5"
  501. matchstr 12 86 "\10"
  502. matchread 30
  503. jump 86
  504. ! -- Modem error correction link negotiation --
  505. ! Userhook 2 informs ARA that a modem-to-modem error
  506. ! correcting protocol has been negotiated
  507. !
  508. !
  509. @LABEL 82
  510. note "Modem Reliable Link Established." 2
  511. userhook 2
  512. jump 32
  513. !
  514. @LABEL 83
  515. note "Modem Reliable Link Established." 2
  516. userhook 2
  517. jump 81
  518. !
  519. ! -- Compression negotiation --
  520. ! Userhook 3 informs ARA that a modem-to-modem compression
  521. ! protocol has been negotiated
  522. !
  523. @LABEL 84
  524. note "Modem Compression Established." 2
  525. userhook 3
  526. jump 32
  527. !
  528. @LABEL 85
  529. note "Modem Compression Established." 2
  530. userhook 3
  531. jump 81
  532. !
  533. !
  534. ! -- Normal exit after "CONNECT" --
  535. !
  536. !  This modem has been setup to do CTS handshaking,
  537. !  and we assume that a CTS handshaking cable is being used.
  538. !
  539. @LABEL 86
  540. ! Turn on CTS handshaking.
  541. HSReset 0 1 0 0 0 0
  542. !
  543. ifANSWER 87
  544. pause 30
  545. @LABEL 87
  546. exit 0
  547. !
  548. !
  549. ! ---- Answer calls ----
  550. !
  551. ! A RING results from the modem in ANSWERING mode
  552. ! claims the serial port and answering the phone
  553. !
  554. @LABEL 88
  555. ifORIGINATE 32
  556. userhook 1
  557. note "Answering phone..." 2
  558. write "ATA\13"
  559. jump 32
  560. !  
  561. ! ---- Hang up and reset modem ----
  562. !
  563. @HANGUP 
  564. @LABEL 90 
  565. settries 0
  566. HSReset 0 0 0 0 0 0
  567. !
  568. @LABEL 91
  569. ! Try to get control of the modem
  570. !pause 1
  571. !write "+++"
  572. !pause 1 
  573. !matchclr
  574. !matchstr 1 96 "OK\13\10"
  575. !pause 15
  576. !write "AT\13"
  577. !matchread 30
  578. !
  579. @LABEL 94
  580. ! Force a hangup                            (ÑÑÑÑÑ Different from Original Wallstreet script)
  581. matchclr
  582. matchstr 1 98 "NO CARRIER\13\10"
  583. matchstr 2 98 "OK\13\10"
  584. matchstr 3 98 "ERROR\13\10"
  585. matchstr 4 98 "0\13\10"
  586. write "+++ATH\13"
  587. matchread 30
  588. ! Try again to get control of the modem by toggling DTR
  589. !
  590. @LABEL 95
  591. DTRClear
  592. Pause 2
  593. DTRSet
  594. flush
  595. !
  596. !
  597. ! Try the hangup sequence three times otherwise declare an error
  598. inctries
  599. iftries 3 101
  600. jump 91
  601. !
  602. @LABEL 96
  603. !
  604. ! Pause between data and command mode
  605. !
  606. pause 50
  607. jump 94
  608. !
  609. !
  610. @LABEL 97
  611. ! AT&F resulted in Error, try again using AT&F
  612. pause 15
  613. matchclr
  614. matchstr 1 99 "OK\13\10"
  615. write "AT&F\13"
  616. matchread 30
  617. jump 101
  618. !
  619. @LABEL 98
  620. ! Got control of the modem.  Recall the factory settings.  If it fails, jump 97.
  621. pause 15
  622. matchclr
  623. matchstr 1 99 "OK\13\10"
  624. matchstr 2 97 "ERROR\13\10"
  625. write "AT&F\13"
  626. matchread 30
  627. jump 101
  628. !
  629. @LABEL 99
  630. exit 0
  631. !
  632. ! ---- Error messages -----
  633. !
  634. ! Modem Not Responding
  635. @LABEL 101
  636. exit -6019
  637. !
  638. ! No Dial Tone
  639. @LABEL 102
  640. exit -6020
  641. !
  642. ! No Carrier or Error
  643. @LABEL 103
  644. exit -6021
  645. !
  646. ! Busy
  647. @LABEL 104
  648. exit -6022
  649. !
  650. ! No Answer
  651. @LABEL 105
  652. exit -6023
  653. !
  654. ! User Cancellation
  655. @LABEL 107
  656. exit -6008
  657. !
  658. ! ---- DELAYED and BLACKLISTED functions ----
  659. @LABEL 110
  660. matchclr
  661. matchstr  1 119 "00:00:0"
  662. matchstr  2 118 "00:00:1"
  663. matchstr  3 117 "00:00:2"
  664. matchstr  4 116 "00:00:3"
  665. matchstr  5 115 "00:00:4"
  666. matchstr  6 114 "00:00:5"
  667. matchstr  7 113 "00:01:"
  668. matchstr  8 112 "00:02:"
  669. matchread 30
  670. !  The number is 'DELAYED' more than 3 minutes.  Exit the script telling the user to wait or reset his modem.
  671. !
  672. exit -6019 "\13The modem responds 'DELAYED':\13(Cannot redial this number right now.)\13To try again immediately, turn modem OFF and ON before proceeding."
  673. @LABEL 111
  674. !  The number is 'BLACKLISTED'.  Exit the script, telling the user to reset his modem.
  675. exit -6019 "\13The modem responds 'BLACKLISTED':\13(Cannot redial this number again.)\13Double-check the number, then turn your modem OFF and ON before proceeding."
  676. !
  677. @LABEL 112
  678. note "'DELAYED'. Redialing in 3 minutes..."
  679. pause 600
  680. @LABEL 113
  681. note "'DELAYED'. Redialing in 2 minutes..."
  682. pause 600
  683. @LABEL 114
  684. note "'DELAYED'. Redialing in 1 minute... "
  685. pause 100
  686. @LABEL 115
  687. note "'DELAYED'. Redialing in 50 seconds..."
  688. pause 100
  689. @LABEL 116
  690. note "'DELAYED'. Redialing in 40 seconds..."
  691. pause 100
  692. @LABEL 117
  693. note "'DELAYED'. Redialing in 30 seconds..."
  694. pause 100
  695. @LABEL 118
  696. note "'DELAYED'. Redialing in 20 seconds..."
  697. pause 100
  698. @LABEL 119
  699. note "'DELAYED'. Redialing in 10 seconds..."
  700. pause 100
  701. jump 1
  702. ! Labels 121-128 are reserved for emergency hacks.
  703. !
  704.